<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>计数器</title>
</head>
<body>
<div id="app">
    <h1>当前计数: {{count}}</h1>
    <button v-on:click='add'>+</button>
    <button @click='sub'>-</button>
</div>
<script src="../js/vue.js"></script>
<script>
    new Vue({
        el:'#app',
        data:{
            count:0
        },
        methods: {
            add: function(){
                console.log('++++');
                this.count++
            },
            sub: function(){
                this.count--
            }
        },
    })
</script>
</body>
</html>